package com.eagle.parser;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import com.github.javaparser.JavaParser;
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;


public class Jparser {
    
     public static void main(String[] args) {
        try {
            //将一个java代码的文本解析为一棵CompilationUnit类型的树
            //CompilationUnit unit = JavaParser.parse(new File("D:\\FpyzdbCshszMicroService.java"));
            InputStream in=new FileInputStream(new File("D://ActivitiesRegisteredServiceImpl.java"));
            CompilationUnit unit = StaticJavaParser.parse(in);
            classUnit vc = new classUnit();
            //在指定的树上进行搜索，然后根据遇到的节点的类型调用具体的回调
            //vc.visit(unit, null);
            unit.accept(vc,null);
            //vc.visit(unit.get);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }

}
